# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-pathutil
_gemname=pathutil
pkgver=0.16.2
pkgrel=4
pkgdesc="A faster pure Ruby implementation of Pathname with extra bits"
url="https://github.com/envygeeks/pathutil"
arch="noarch"
license="MIT"
depends="ruby ruby-forwardable-extended"
checkdepends="ruby-rspec ruby-safe_yaml"
source="https://github.com/envygeeks/pathutil/archive/v$pkgver/$_gemname-$pkgver.tar.gz
	fix-ruby-keyword-parameter.patch
	fix-ruby-3.1-compat.patch
	tests-skip-broken.patch
	tests-remove-unnecessary-requires.patch
	gemspec.patch
	"
builddir="$srcdir/$_gemname-$pkgver"

# FIXME
# 1) Pathutil#glob should yield a given block with each file
#    Failure/Error:
#      expect { |b| subject.glob("*", &b) }.to yield_successive_args(
#        *([described_class] * Dir.glob(subject.join("*")).size)
#      )
#    SystemStackError:
#      stack level too deep
# passes locally?
options="$options !check"


build() {
	gem build Gem.gemspec
}

check() {
	rspec .
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install \
		--local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	# Remove unnecessary files and rubbish...
	cd "$gemdir"
	rm -r cache build_info doc extensions
}

sha512sums="
d06daf365b94dacd33966f3928a53f0f00d2fca7b9f6348a7efd2b55ab5ba937459e5bd78fde241f30749a1ae55e4ae3ba1ed8945b5333464e7d3ce9666cd054  pathutil-0.16.2.tar.gz
f83401da2c498b35749740ffe830e9d311f125c322624eb36bd494b590d56d041c90681193e9b6a0ce167f6349a12809a6dff292f01ac7508f1ea507a857ed60  fix-ruby-keyword-parameter.patch
4080215d73031945e19d64df0fe5bd76941032c1cd863df29bd4c9b0c19370ed3b07d424ce1f27fc1723b7bc104948cf3a37f0dd8f99df15946584a9ed83a060  fix-ruby-3.1-compat.patch
2d6caad85a40600a6cc3f556e06e7b9fa9b5392594288caa345b8b02ded85d90dc02e612e05e942e9161a11711be2a388bc30f01502859cec75f53bdca23ceaa  tests-skip-broken.patch
c3f2a2bda0daaae245168b352510d054594e1b739899a629ee6322f7f8eb1a0d561b4d431d1e38420746f6d60e0887e2719a14e3354163a1a8cc5fc141c55a7b  tests-remove-unnecessary-requires.patch
3e6102cab755624de59d925da8031a0c774052cbb85977a93ca6b45436192152e53b61f9d125898ab47e7761b47ae00f0da5210c229c3ec4ae57005bb5391e72  gemspec.patch
"
